Skip to content

test(clinical-dashboard): assert upload-layout hook wires useSyncExternalStore#1047

Merged
BigSimmo merged 3 commits into
mainfrom
claude/maturity-x3-upload-layout-guard
Jul 21, 2026
Merged

test(clinical-dashboard): assert upload-layout hook wires useSyncExternalStore#1047
BigSimmo merged 3 commits into
mainfrom
claude/maturity-x3-upload-layout-guard

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

Test-only follow-up to #1042 (merged). The audit-navigation-auth-regressions guard that pins the
upload view's viewport-driven region/tabpanel role asserted only that the extracted hook file
contains the string subscribeToUploadDesktopLayout — which passes even if the helper is
declared-but-unused or the subscription is disconnected. CodeRabbit flagged exactly this on #1042,
but that PR merged with the weaker assertion, so the hollow guard is now on main.

This strengthens the assertion to match the actual wiring —
useSyncExternalStore(subscribeToUploadDesktopLayout, getUploadDesktopLayoutSnapshot, () => false)
so the guard now fails on a disconnected subscription, a dropped SSR server-snapshot, or a
present-but-unused helper. No production code changes: use-upload-desktop-layout.ts is untouched;
only the test is hardened.

Verification

  • npx vitest run tests/audit-navigation-auth-regressions.test.ts — 8/8 passing
  • npx eslint tests/audit-navigation-auth-regressions.test.ts — clean
  • Adversarial regex check — the pattern MATCHES the current wiring and REJECTS all three
    regression variants (disconnected subscription, dropped () => false snapshot, present-but-unused
    helper), proving the guard actually guards rather than just matching a symbol name.
  • UI verification not run: test-only change; no component, layout, token, or routing change.

Risk and rollout

  • Risk: low — a single test-assertion strengthening; no production code touched.
  • Rollback: revert the single commit.
  • Provider or production effects: None.

Clinical Governance Preflight

Not applicable — this is a test-only change to a navigation/auth regression guard. It touches no
ingestion, answer generation, retrieval/ranking, source governance, document access, privacy,
schema, or production behaviour (scripts/pr-policy.mjs classifies the path as non-clinical).

Notes

🤖 Generated with Claude Code


Generated by Claude Code

Summary by CodeRabbit

  • Tests
    • Strengthened regression coverage for upload desktop layout behavior.
    • Added validation that the client subscription wiring uses useSyncExternalStore with the expected subscribe and snapshot providers.
    • Added validation for the server-rendered fallback behavior to ensure consistent SSR/client results.

…rnalStore

The audit-navigation guard asserted the hook file merely *contains*
`subscribeToUploadDesktopLayout`, which passes even if the helper is
declared-but-unused or the subscription is disconnected. Match the actual
useSyncExternalStore(subscribe, snapshot, () => false) wiring instead, so the
guard fails on a disconnected subscription, a dropped SSR server-snapshot, or a
present-but-unused helper.

Follow-up to CodeRabbit's nitpick on #1042, which merged with the weaker
assertion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Jc1ZYHFjXjn6mE6U6riVU
@supabase

supabase Bot commented Jul 21, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4c3743c7-2bac-44fb-a218-3a7c205536c6

📥 Commits

Reviewing files that changed from the base of the PR and between ddbb719 and 682a5d1.

📒 Files selected for processing (1)
  • tests/audit-navigation-auth-regressions.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/audit-navigation-auth-regressions.test.ts

📝 Walkthrough

Walkthrough

The regression test now verifies that the upload desktop layout hook passes the subscription function, snapshot getter, and () => false server fallback to useSyncExternalStore.

Changes

Upload layout regression coverage

Layer / File(s) Summary
Upload layout store contract assertion
tests/audit-navigation-auth-regressions.test.ts
Replaces a reference-only check with a regex assertion covering the hook’s complete useSyncExternalStore wiring.

Estimated code review effort: 2 (Simple) | ~5 minutes

Possibly related PRs

  • BigSimmo/Database#1042: Extracts the desktop-layout store into the hook whose subscription wiring this regression test validates.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the test-only change to the upload-layout hook assertion.
Description check ✅ Passed The description matches the template and includes summary, verification, risk/rollback, governance notes, and rollout impact.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/maturity-x3-upload-layout-guard

Comment @coderabbitai help to get the list of available commands.

@BigSimmo
BigSimmo marked this pull request as ready for review July 21, 2026 21:36

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ddbb7192de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/audit-navigation-auth-regressions.test.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/audit-navigation-auth-regressions.test.ts`:
- Around line 185-186: Update the useSyncExternalStore assertion for
uploadDesktopHookSource to match the complete returned call: require the return
keyword, all expected arguments, and the closing parenthesis so comments,
strings, prefixes, or unused helpers cannot satisfy the regression check.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: af4b8efe-bcf9-41f3-b99c-04cbca778ddb

📥 Commits

Reviewing files that changed from the base of the PR and between f85c09b and ddbb719.

📒 Files selected for processing (1)
  • tests/audit-navigation-auth-regressions.test.ts

Comment thread tests/audit-navigation-auth-regressions.test.ts Outdated
…rted return

Scope the useSyncExternalStore wiring assertion to the exported
useUploadDesktopLayout body and require the returned call to close right after
the () => false server snapshot. This closes the gaps Codex and CodeRabbit both
flagged: a stale/dead call elsewhere in the file, a present-but-unused helper, a
missing return, or a mutated snapshot like `() => false || getSnapshot()` can no
longer satisfy the guard.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Jc1ZYHFjXjn6mE6U6riVU
@BigSimmo
BigSimmo merged commit b981caa into main Jul 21, 2026
26 checks passed
@BigSimmo
BigSimmo deleted the claude/maturity-x3-upload-layout-guard branch July 21, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants